package cn.gson.school.controller.caiwu;

import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONArray;
import cn.gson.school.dao.caiwu.*;
import cn.gson.school.dao.jiaoxue.*;
import cn.gson.school.dao.zhaosheng.InputStudentDao;
import cn.gson.school.entity.caiwu.*;
import cn.gson.school.entity.jiaoxue.*;

/**
 * 财务模块
 * 
 * @author lc
 *
 */
@Controller
@RequestMapping("/caiwu")
public class CaiWuController {
	@Autowired
	private ShouKuanDao shoukuandao;
	
	@Autowired
	private ShouKuanInfoDao shoukuaninfodao;
	
	@Autowired
	private ClassDao classDao;
	
	@Autowired
	private StudentDao studentDao;
	
	//查询班级下面的所有的学生
		@GetMapping("/teamcontent/{id}")
		@ResponseBody
		public Map<String, Object> neirong(@PathVariable(name = "id", required = false) Long id) {
		System.out.println("进来了");
			Map<String, Object> obj = new HashMap<String, Object>();
			obj.put("success", false);
			Iterable<StudentEntity> list = studentDao.findByClassId(id);
			if (list != null) {
				obj.put("message", list);
				obj.put("success", true);
			}
			return obj;
		}
	
	
	@RequestMapping("/cw-shoukuan-list")
	public void shoukuanList() {

	}

	@RequestMapping("/cw-fupin-list")
	public void fupinList() {

	}
	@RequestMapping("/cw-tuikuan-list")
	public void tuikuan() {

	}
	
	@RequestMapping("/cw-add-shoukuan")
	public void addShouKuan() {
		
	}
	
	@RequestMapping("/cw-zhexian")
	public void zhexian(Model model) {
		Date date = new Date();
		Calendar c = Calendar.getInstance();
		c.setTime(date);
		int year = c.get(Calendar.YEAR);
		System.out.println("year:"+year);
		int[] years= {year-6,year-5,year-4,year-3,year-2,year-1,year};
		System.out.println("报表"+years);
		//收款金额 
		/*List<ShouKuanInfoEntity> input = shoukuaninfodao.ChaXunpayTime(years[0]);
		List<ShouKuanInfoEntity> input1 = shoukuaninfodao.ChaXunpayTime(years[1]);
		List<ShouKuanInfoEntity> input2 = shoukuaninfodao.ChaXunpayTime(years[2]);
		List<ShouKuanInfoEntity> input3 = shoukuaninfodao.ChaXunpayTime(years[3]);
		List<ShouKuanInfoEntity> input4 = shoukuaninfodao.ChaXunpayTime(years[4]);
		List<ShouKuanInfoEntity> input5 = shoukuaninfodao.ChaXunpayTime(years[5]);
		List<ShouKuanInfoEntity> input6 = shoukuaninfodao.ChaXunpayTime(years[6]);*/
		//查询总金额
		/*System.out.println("money:");
		List<ShouKuanEntity> money=shoukuaninfodao.chaXunMoney(years[0]);
		List<ShouKuanEntity> money1=shoukuaninfodao.chaXunMoney(years[1]);
		List<ShouKuanEntity> money2=shoukuaninfodao.chaXunMoney(years[2]);
		List<ShouKuanEntity> money3=shoukuaninfodao.chaXunMoney(years[3]);
		List<ShouKuanEntity> money4=shoukuaninfodao.chaXunMoney(years[4]);
		List<ShouKuanEntity> money5=shoukuaninfodao.chaXunMoney(years[5]);
		List<ShouKuanEntity> money6=shoukuaninfodao.chaXunMoney(years[6]);*/
		
		
		//查询年收入
		/*model.addAttribute("inputStudentCount", JSONArray.toJSONString(input.size()));
		model.addAttribute("inputStudentCount1", JSONArray.toJSONString(input1.size()));
		model.addAttribute("inputStudentCount2", JSONArray.toJSONString(input2.size()));
		model.addAttribute("inputStudentCount3", JSONArray.toJSONString(input3.size()));
		model.addAttribute("inputStudentCount4", JSONArray.toJSONString(input4.size()));
		model.addAttribute("inputStudentCount5", JSONArray.toJSONString(input5.size()));
		model.addAttribute("inputStudentCount6", JSONArray.toJSONString(input6.size()));*/
		
		/*model.addAttribute("money", JSONArray.toJSONString(money.size()));
		model.addAttribute("money1", JSONArray.toJSONString(money1.size()));
		model.addAttribute("money2", JSONArray.toJSONString(money2.size()));
		model.addAttribute("money3", JSONArray.toJSONString(money3.size()));
		model.addAttribute("money4", JSONArray.toJSONString(money4.size()));
		model.addAttribute("money5", JSONArray.toJSONString(money5.size()));
		model.addAttribute("money6", JSONArray.toJSONString(money6.size()));*/
	}
}
